/*
 ****************************************************************************************
 *
 * @file       gaf_sig_defines.h
 * @version    v1.0
 * @brief      
 * @attention
 *  Copyright (C) 2024 Freqchip.   \n
 *  All rights reserved.           \n
 * 
 * 
 ****************************************************************************************
 */

#ifndef _GAF_SIG_DEFINES_H
#define _GAF_SIG_DEFINES_H

#include <stdint.h>

#define BIT(x)      (1<<x)

/** @defgroup Codec Coding_Format Definitions
 * @{
 */
#define U_LAW_LOG                   0x00
#define A_LAW_LOG                   0x01
#define CVSD                        0x02
#define TRANSPARENT                 0x03
#define LINEAR_PCM                  0x04
#define MSBC                        0x05
#define LC3                         0x06
#define G_729A                      0x07
#define VENDOR_SPECIFIC             0xff
/** @} End Codec Coding_Format DEFINES */

/** @defgroup Audio Location Definitions
 * @{
 */
#define MONO_AUDIO                  0x00
#define FRONT_LEFT                  BIT(0)
#define FRONT_RIGHT                 BIT(1)
#define FRONT_CENTER                BIT(2)
#define LOW_FREQ_EFFECTS_1          BIT(3)
#define BACK_LEFT                   BIT(4)
#define BACK_RIGHT                  BIT(5)
#define FRONT_LEFT_OF_CENTER        BIT(6)
#define FRONT_RIGHT_OF_CENTER       BIT(7)
#define BACK_CENTER                 BIT(8)
#define LOW_FREQ_EFFECTS_2          BIT(9)
#define SIDE_LEFT                   BIT(10)
#define SIDE_RIGHER                 BIT(11)
#define TOP_FRONT_LEFT              BIT(12)
#define TOP_FRONT_RIGHT             BIT(13)
#define TOP_FRONT_CENTER            BIT(14)
#define TOP_CENTER                  BIT(15)
#define TOP_BACK_LEFT               BIT(16)
#define TOP_BACK_RIGHT              BIT(17)
#define TOP_SIDE_LEFT               BIT(18)
#define TOP_SIDE_RIGHT              BIT(19)
#define TOP_BACK_CENTER             BIT(20)
#define BOTTOM_FRONT_CENTER         BIT(21)
#define BOTTOM_FRONT_LEFT           BIT(22)
#define BOTTOM_FRONT_RIGHT          BIT(23)
#define FRONT_LEFT_WIDE             BIT(24)
#define FRONT_RIGHT_WIDE            BIT(25)
#define LEFT_SURROUND               BIT(26)
#define RIGHT_SURROUND              BIT(27)
/** @} End Audio Location Definitions DEFINES */

/** @defgroup Context Type Definitions
 * @{
 */
#define PROHIBITED                  0x00 
#define UNSPECIFIED                 BIT(0)
#define CONVERSATIONAL              BIT(1)
#define MEDIA                       BIT(2)
#define GAME                        BIT(3)
#define INSTRUCTIONAL               BIT(4)
#define VOICE_ASSISTANTS            BIT(5)
#define LIVE                        BIT(6)
#define SOUND_EFFECTS               BIT(7)
#define NOTIFICATIONS               BIT(8)
#define RINGTONE                    BIT(9)
#define ALERTS                      BIT(10)
#define EMERGENCY_ALARM             BIT(11)
/** @} End Context Tyoe DEFINES */

// -----------------------------------------------------------------------------
// ----------------- Codec_Specific_Capabilities LTV Defines -------------------
// -----------------------------------------------------------------------------

/** @defgroup Supported_Sampling_Frequencies Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       2 Octets      |
//  -----------------------------------------
//  |  0x03  |  0x01  |                     | 
//  -----------------------------------------
#define SUPPROT_SAMPLING_FREQUENCEIS_LENGTH     0x03
#define SUPPROT_SAMPLING_FREQUENCEIS            0x01

#define SUPPROT_FREQ_8000_Hz                BIT(0)  
#define SUPPROT_FREQ_11025_Hz               BIT(1)  
#define SUPPROT_FREQ_16000_Hz               BIT(2)  
#define SUPPROT_FREQ_22050_Hz               BIT(3)
#define SUPPROT_FREQ_24000_Hz               BIT(4)
#define SUPPROT_FREQ_32000_Hz               BIT(5)
#define SUPPROT_FREQ_44100_Hz               BIT(6)
#define SUPPROT_FREQ_48000_Hz               BIT(7)
#define SUPPROT_FREQ_88200_Hz               BIT(8)
#define SUPPROT_FREQ_96000_Hz               BIT(9)
#define SUPPROT_FREQ_176400_Hz              BIT(10)
#define SUPPROT_FREQ_192000_Hz              BIT(11)
#define SUPPROT_FREQ_384000_Hz              BIT(12)
/** @} End Supported_Sampling_Frequencies DEFINES */

/** @defgroup Supported_Frame_Durations Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       1 Octets      |
//  -----------------------------------------
//  |  0x02  |  0x02  |                     | 
//  -----------------------------------------
#define SUPPORT_FRAME_DURATIONS_LENGTH      0x02
#define SUPPORT_FRAME_DURATIONS             0x02

#define SUPPROT_FRAME_DURATION_7_5_ms       BIT(0)  
#define SUPPROT_FRAME_DURATION_10_ms        BIT(1)  
#define PREFERRED_7_5_MS                    BIT(4)  
#define PREFERRED_10_MS                     BIT(5)
/** @} End Supported_Frame_Durations DEFINES */

/** @defgroup Supported_Audio_Channel_Counts Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       1 Octets      |
//  -----------------------------------------
//  |  0x02  |  0x03  |                     | 
//  -----------------------------------------
#define SUPPORT_AUDIO_CHANNEL_COUNTS_LENGTH     0x02
#define SUPPORT_AUDIO_CHANNEL_COUNTS            0x03

#define CHANNEL_COUNT_1             BIT(0)
#define CHANNEL_COUNT_2             BIT(1)
#define CHANNEL_COUNT_3             BIT(2)
#define CHANNEL_COUNT_4             BIT(3)
#define CHANNEL_COUNT_5             BIT(4)
#define CHANNEL_COUNT_6             BIT(5)
#define CHANNEL_COUNT_7             BIT(6)
#define CHANNEL_COUNT_8             BIT(7)
/** @} End Supported_Audio_Channel_Counts DEFINES */

/** @defgroup Supported_Octets_Per_Codec_Frame Definitions.
 * @{
 */
//  | Length |  Type  | Min num value | Max num value |
//  --------------------------------------------------
//  |1 Octets|1 Octets|    2 Octets   |    2 Octets   |
//  ---------------------------------------------------
//  |  0x05  |  0x04  |               |               | 
//  ---------------------------------------------------
#define SUPPORT_OCTETS_PER_CODEC_FRAME_LENGTH   0x05
#define SUPPORT_OCTETS_PER_CODEC_FRAME          0x04
/** @} End Supported_Octets_Per_Codec_Frame DEFINES */

/** @defgroup Supported_Max_Codec_Frames_Per_SDU Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       4 Octets      |
//  -----------------------------------------
//  |  0x02  |  0x05  |                     | 
//  -----------------------------------------
#define SUPPORT_MAX_CODEC_FRAME_PER_SDU_LENGTH  0x02
#define SUPPORT_MAX_CODEC_FRAME_PER_SDU         0x05
/** @} End Supported_Max_Codec_Frames_Per_SDU DEFINES */

// ------------------------------------------------------------------------------
// ----------------- Codec_Specific_Configuration LTV Defines -------------------
// ------------------------------------------------------------------------------

/** @defgroup Sampling_Frequencies Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       1 Octets      |
//  -----------------------------------------
//  |  0x02  |  0x01  |                     | 
//  -----------------------------------------
#define SAMPLING_FREQUENCEIS_LENGTH     0x02
#define SAMPLING_FREQUENCEIS            0x01

#define FREQ_8000_Hz                0x01
#define FREQ_11025_Hz               0x02
#define FREQ_16000_Hz               0x03  
#define FREQ_22050_Hz               0x04
#define FREQ_24000_Hz               0x05
#define FREQ_32000_Hz               0x06
#define FREQ_44100_Hz               0x07
#define FREQ_48000_Hz               0x08
#define FREQ_88200_Hz               0x09
#define FREQ_96000_Hz               0x0A
#define FREQ_176400_Hz              0x0B
#define FREQ_192000_Hz              0x0C
#define FREQ_384000_Hz              0x0D
/** @} End Sampling_Frequencies DEFINES */

/** @defgroup Frame_Durations Definitions.
 * @{
 */
//  | Length |  Type  |        Value        |
//  -----------------------------------------
//  |1 Octets|1 Octets|       1 Octets      |
//  -----------------------------------------
//  |  0x02  |  0x02  |                     | 
//  -----------------------------------------
#define FRAME_DURATIONS_LENGTH      0x02
#define FRAME_DURATIONS             0x02

#define FRAME_DURATION_7_5_ms       0x00
#define FRAME_DURATION_10_ms        0x01  
/** @} End Frame_Durations DEFINES */

/** @defgroup Audio_Channel_Allocation Definitions.
 * @{
 */
//  | Length |  Type  |    Value      |
//  -----------------------------------
//  |1 Octets|1 Octets|    4 Octets   |
//  -----------------------------------
//  |  0x05  |  0x03  |               |
//  -----------------------------------
//  Value: 4-octet bitfield of Audio Location values
#define AUDIO_CHANNEL_ALLOCATION_LENGTH   0x05
#define AUDIO_CHANNEL_ALLOCATION          0x03
/** @} End Audio_Channel_Allocation DEFINES */

/** @defgroup Octets_Per_Codec_Frame Definitions.
 * @{
 */
//  | Length |  Type  |    Value      |
//  -----------------------------------
//  |1 Octets|1 Octets|    2 Octets   |
//  -----------------------------------
//  |  0x03  |  0x04  |               |
//  -----------------------------------
//  Value: Number of octets used per codec frame
#define OCTETS_PER_CODEC_FRAME_LENGTH   0x03
#define OCTETS_PER_CODEC_FRAME          0x04
/** @} End Octets_Per_Codec_Frame DEFINES */

/** @defgroup Codec_Frame_Blocks_Per_SDU Definitions.
 * @{
 */
//  | Length |  Type  |    Value      |
//  -----------------------------------
//  |1 Octets|1 Octets|    1 Octets   |
//  -----------------------------------
//  |  0x02  |  0x05  |               |
//  -----------------------------------
//  Value: Number of blocks of codec frames per SDU
#define CODEC_FRAME_BLOCKS_PER_SDU_LENGTH   0x02
#define CODEC_FRAME_BLOCKS_PER_SDU          0x05
/** @} End Codec_Frame_Blocks_Per_SDU DEFINES */

#endif//_GAF_SIG_DEFINES_H